package syncagenttester;

import java.util.Dictionary;
import java.util.Hashtable;

import org.osgi.service.event.Event;  
import org.osgi.service.event.EventAdmin;  

public class EventPublisher { 
	private EventAdmin eventAdmin; 
	
	public void publish() {  
		if (getEventAdmin() != null) {            
			getEventAdmin().postEvent(new Event("org/dynamicjava/test1",  
					getEventProperties("1")));  
			getEventAdmin().postEvent(new Event("org/dynamicjava/test1",  
					getEventProperties("2")));  
			getEventAdmin().postEvent(new Event("org/dynamicjava/test2",  
					getEventProperties("1")));  
		}  
	}  


	protected Dictionary getEventProperties(String property1Value) {  
		Dictionary result = new Hashtable();  
		result.put("property1", property1Value);  
		return result;  
	}  

	public EventAdmin getEventAdmin() {  
		return eventAdmin;  
	}  

	public void setEventAdmin(EventAdmin eventAdmin) {  
		this.eventAdmin = eventAdmin;  
	}  

}     